package org.xxpay.pay.channel.guanghui;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

public class GhpayConfig extends AbstractPaymentConfig {

    public static final String CHANNEL_NAME = "ghpay";
    public static final String CHANNEL_NAME_QUICK_WAP = CHANNEL_NAME + "_quick_wap";
    public static final String CHANNEL_NAME_B2C = CHANNEL_NAME + "_b2c";
    public static final String CHANNEL_NAME_JD_QR = CHANNEL_NAME + "_jd_qr";
    public static final String CHANNEL_NAME_UNION = CHANNEL_NAME + "_union_qr";
    public static final String CHANNEL_NAME_ALI_QR = CHANNEL_NAME + "_ali_qr";
    public static final String CHANNEL_NAME_WX_QR = CHANNEL_NAME + "_wx_qr";

    public static final String RESPONSE_RESULT_OK = "00"; // 返回上游成功
    public static final String RESPONSE_OK = "0"; // 返回上游成功
    public static final String RESPONSECODE = "{\"responseCode\": \"0000\"}"; // 返回上游成功

    GhpayConfig(String payParam ){
        Assert.notNull(payParam, "init sft config error");
        JSONObject object = JSON.parseObject(payParam);
        //商户号
        setMchId(object.getString("mchId"));
        //机构号
        setAppId(object.getString("appId"));
        //签名密钥
        setPrivateKey(object.getString("privateKey"));
        //业务数据加密密钥 (publicKey)
        setPublicKey(object.getString("publicKey"));

        setRequestUrl(object.getString("requestUrl"));
        //产品id
        setPayProduct(object.getString("payProduct"));
        //bus_no
        setPayMode(object.getString("payMode"));

    }
}
